﻿<UserControl
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:Titler"
             xmlns:data="clr-namespace:Titler.ControlModels"
             xmlns:Properties="clr-namespace:Titler.Properties"
             x:Name="CtrlThread"
             x:Class="Titler.Controls.ThreadCtrl"
             mc:Ignorable="d" 
             MinWidth="200">


    <UserControl.Resources>
        
        <Style x:Key="{x:Type Label}" TargetType="{x:Type Label}">
            <Setter Property="Padding" Value="2"/>
            <Setter Property="Margin" Value="0,0,0,2"/>
            <Setter Property="HorizontalContentAlignment" Value="Center"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="Height" Value="30"/>
            <Setter Property="FontFamily" Value="Segoe UI"/>
            <Setter Property="FontSize" Value="12pt"/>
        </Style>
        
        <Style x:Key="{x:Type ComboBox}" TargetType="{x:Type ComboBox}">
            <Setter Property="Padding" Value="2"/>
            <Setter Property="Margin" Value="0,0,0,2"/>
            <Setter Property="Background">
                <Setter.Value>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FFF3F3F3" Offset="0.45"/>
                        <GradientStop Color="#FFE0E0E0" Offset="0.55"/>
                    </LinearGradientBrush>
                </Setter.Value>
            </Setter>
            <Setter Property="BorderBrush" Value="#FF707070"/>
            <Setter Property="Height" Value="30"/>
            <Setter Property="FontFamily" Value="Segoe UI"/>
            <Setter Property="FontSize" Value="12pt"/>
            <Setter Property="HorizontalContentAlignment" Value="Center"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
        </Style>
        
        <data:PMControlModel x:Key="pMControlModelView" />

    </UserControl.Resources>


    <Grid Margin="0"
          DataContext="{StaticResource pMControlModelView}">
        
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        
        <StackPanel x:Name="Txt_Stack">
            <Label x:Name="Txt_Diameter" Content="Diameter (in)" 
                   HorizontalContentAlignment="Center" Height="30"/>
            <Label x:Name="Txt_Weight" Content="Weight (ppf)" 
                   HorizontalContentAlignment="Center" Height="30"/>
            <Label x:Name="Txt_Thread" Content="Thread" 
                   HorizontalContentAlignment="Center" Height="30"/>
            <Label x:Name="Txt_Profile" Content="Profile" 
                   HorizontalContentAlignment="Center" Height="30" Margin="0"/>
        </StackPanel>
        
        <StackPanel x:Name="Combo_Stack" Grid.Column="1">

            <ComboBox x:Name="Diameter" Height="30" IsEditable="True" Text="{Binding Diameter}"
                      ItemsSource="{Binding Source={x:Static Properties:Settings.Default}, Path=List_Diameter}"
                      HorizontalContentAlignment="Center" VerticalContentAlignment="Center" 
                      Cursor="Cross" ToolTip="Thread Diameter" 
                      IsSynchronizedWithCurrentItem="True"
                      LostFocus="Control_Add_Item" />
            
            <ComboBox x:Name="Weight" Height="30" IsEditable="True" Text="{Binding Weight}"
                      ItemsSource="{Binding Source={x:Static Properties:Settings.Default}, Path=List_Weight}"
                      HorizontalContentAlignment="Center" VerticalContentAlignment="Center" 
                      Cursor="Cross" ToolTip="Thread Weight" 
                      IsSynchronizedWithCurrentItem="True"
                      LostFocus="Control_Add_Item">
            </ComboBox>
            <ComboBox x:Name="Thread" Height="30" IsEditable="True" Text="{Binding Thread}"
                      ItemsSource="{Binding Source={x:Static Properties:Settings.Default}, Path=List_Thread}"
                      HorizontalContentAlignment="Center" VerticalContentAlignment="Center" 
                      Cursor="Cross" ToolTip="Thread Type" 
                      IsSynchronizedWithCurrentItem="True" 
                      LostFocus="Control_Add_Item">
            </ComboBox>
            <ComboBox x:Name="Profile" Height="30" Text="{Binding Profile}"
                      ItemsSource="{Binding Source={x:Static Properties:Settings.Default}, Path=List_Profile}"
                      HorizontalContentAlignment="Center" VerticalContentAlignment="Center" 
                      Margin="0" ToolTip="Thread Profile" 
                      IsSynchronizedWithCurrentItem="True"
                      LostFocus="Control_Add_Item"
                      Cursor="Cross">
            </ComboBox>
        </StackPanel>
    </Grid>
</UserControl>
